<?php
require_once realpath (dirname (__FILE__) . '//..//..//..//..//pages.php');
require_once INC_FUNCTIONS;
$db = openConnection();
$result = $db->select (array ('ricovero', 'tipo_ricovero'), array ('tipo_ricovero.nome', 'COUNT(*) AS tipi'), 'ricovero.IDtipo_ricovero=tipo_ricovero.ID', 'tipo_ricovero.ID', 'tipo_ricovero.nome');
while ($row = $db->fetchAssoc ($result)) {
    $x[] = $row['nome'];
    $y[] = $row['tipi'];
}

if (!isset ($x) || empty ($x) || !isset ($y) || empty ($y)) {
    notify ('No data to load');
    exit ();
}

require_once GRAPH_PIE;
?>
